<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ include file="/page/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%-- <%@ include file="/adapter/adapter-easyui.jsp" %> --%>
<%@ include file="/adapter/adapter-bootstrap.jsp" %>
<link href="${pageContext.request.contextPath}/frontframe/easyui/themes/easyui-extend.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">

function save(){
	var str_data=$("#deviceinfo input").map(function(){
		   return ($(this).attr("name")+'='+$(this).val());
		 }).get().join("&") ;
    $.ajax({
        url:"${ctx}/appDeviceRegister/addDevice",
        type: "POST",      
        dataType:"json",
        data: str_data,
        async: false,
        success: function(data) {
        	if(data.flag>0){
	            alert("保存成功！");	
	            //window.location.reload();
        	}
/* 	          $.each(data, function(index, element) {
             window.location.reload();
          }); */
        },
        error: function() {
          alert("error");
        }
      });
}

function changeValue(Value){
	document.getElementById("isAllow").value=Value;
}
function  goBack(){
	//window.location.href='${ctx}/auth/appDeviceList?appid=${appid}';
	window.history.back(-1);
	//window.history.go(-2);
}
</script>
</head>
<body>
     <div class="panel panel-default">
   <div class="panel-heading">
      <h3 class="panel-title">
          	设备基本信息
      </h3>
   </div>
   <div class="panel-body">
	<!-- <div id="p" class="easyui-panel" title="交易信息" style="width:100%;height:100%;padding:10px;" > -->
              <form class="form-horizontal" role="form"  id="deviceinfo">
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="appId">移动标识</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appId" name="appId" type="text"  readonly="readonly"  value="${appid}" placeholder=""/>
                          </div>  
                          <label class="col-xs-2 control-label" for="deviceId">设备ID</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="deviceId" name="deviceId" type="text"   value="" placeholder=""/>
                          </div>                           
                       </div>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="appUserid">归属用户</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="appUserid" name="appUserid" type="text"  placeholder=""/>
                          </div>  
                          <div class="col-xs-4">
                             <input class="form-control" id="mobilePhone" name="mobilePhone" type="hidden"  readonly="readonly" value="" placeholder=""/>
                          </div>                           
                       </div>
                       <div class="form-group">
                          <label class="col-xs-2 control-label" for="deviceType">设备类型</label>
                          <div class="col-xs-4">
                             <input class="form-control" id="deviceType" name="deviceType" type="text"    value="" placeholder=""/>
                          </div>
                          <label class="col-xs-2 control-label" for="isAllow">是否允许访问</label>
                          <div class="col-xs-4">
                           <input class="form-control" id="isAllow"  name="isAllow" type="hidden"  value="N" placeholder=""/>
                           <select id="isAllow2" name="isAllow2" class="form-control" onclick="changeValue(this.value)">
                           		<option value="Y">是</option>
                           		<option value="N"  selected="selected">否</option>
                           </select>
                          </div>                          
                       </div>
                       <div class="form-group  text-center">
                            <button type="button" class="btn btn-default"  onclick="save();">保存</button>
                            <button type="button" class="btn btn-default"   onclick="goBack()">返回</button>
                      </div>
                </form>
	</div>
	</div>

</body>
</html>
